package com.xquant.marketdata.marketdata.service.impl;

import com.github.pagehelper.PageInfo;
import com.xquant.marketdata.marketdata.mapper.IndexMapper;
import com.xquant.marketdata.marketdata.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Auther: B946
 * @Date: 23/12/2019 10:17
 * @Description:
 */
@Service
public class IndexServiceImpl implements IndexService {


    @Autowired
    private IndexMapper indexInfoMapper;

    @Override
    public PageInfo<Map>  getIndexInfo(Map<String,Object> params){
        List<Map>   list = indexInfoMapper.getIndexInfo(params);
        return new PageInfo<Map>(list);
    }

    @Override
    public PageInfo<Map>  queryIndexInfoByPage(Map<String,Object> params){
        List<Map>   list = indexInfoMapper.queryIndexInfoByPage(params);
        return new PageInfo<Map>(list);
    }

    @Override
    public PageInfo<Map>  queryIndexPriceByPage(Map<String,Object> params){
        List<Map>   list = indexInfoMapper.queryIndexPriceByPage(params);
        return new PageInfo<Map>(list);
    }

    @Override
    public PageInfo<Map>  queryIndexCompByPage(Map<String,Object> params){
        List<Map>   list = indexInfoMapper.queryIndexCompByPage(params);
        return new PageInfo<Map>(list);
    }

    @Override
    public void updateIndexInfo(Map map) {
        indexInfoMapper.updateIndexInfo(map);
    }

    @Override
    public void updateIndexPrice(Map map) {
        indexInfoMapper.updateIndexPrice(map);
    }

    @Override
    public void updateIndexComp(Map map) {
        map.put("pipeId","0");
        map.put("impDate",new Date());
        map.put("impTime",new Date());
        indexInfoMapper.updateIndexComp(map);
    }

    @Override
    public void insertIndexInfo(Map map) {
        indexInfoMapper.insertIndexInfo(map);
    }

    @Override
    public void insertIndexPrice(Map map) {
        indexInfoMapper.insertIndexPrice(map);
    }

    @Override
    public void insertIndexComp(Map map) {
        indexInfoMapper.insertIndexComp(map);
    }

    @Override
    public void deleteIndexInfo(Map map) {
        indexInfoMapper.deleteIndexInfo(map);
    }

    @Override
    public void deleteIndexPrice(Map map) {
        indexInfoMapper.deleteIndexPrice(map);
    }

    @Override
    public void deleteIndexComp(Map map) {
        indexInfoMapper.deleteIndexComp(map);
    }


}
